#include("../../comm/FormHead.html")
<div id="main">
    <form action="" class="layui-form margin-10" lay-filter="form">
        <input type="hidden" id="actions" name="actions" value="#(form.actions)">
        <input type="hidden" id="data_img1" name="data_img1" value="#(notice.data_img1)">
        <input type="hidden" id="data_img2" name="data_img2" value="#(notice.data_img2)">
        <input type="hidden" id="data_img3" name="data_img3" value="#(notice.data_img3)">
        <input type="hidden" id="data_img4" name="data_img4" value="#(notice.data_img4)">
        <input type="hidden" id="data_img5" name="data_img5" value="#(notice.data_img5)">
        #(token??)

        <div class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-form-item">
                    <label class="layui-form-label">主键ID</label>

                    <div class="layui-input-block">
                        <input type="text" readonly name="not_id"
                               placeholder="自动生成" value="#(notice.not_id)" class="layui-input input-readonly">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-form-item">
                    <label class="layui-form-label">通知标题</label>

                    <div class="layui-input-block">
                        <input type="text" name="not_title" placeholder="请输入通知标题"
                               value="#(notice.not_title)" class="layui-input">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-form-item">
                    <label class="layui-form-label">发布时间</label>

                    <div class="layui-input-block">
                        <input type="text" id="not_time" name="not_time" placeholder="请选择发布时间"
                               value="#(notice.not_times)" class="layui-input">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-form-item">
                    <label class="layui-form-label">正文图片</label>

                    <div class="layui-input-block">
                        <div class="layui-upload">
                            <img class="layui-upload-img" id="image1" src="" style="width:60px;height:60px">
                            <button type="button" class="layui-btn" style="vertical-align:bottom" id="imagebtn1">图1</button>
                            <img class="layui-upload-img" id="image2" src="" style="width:60px;height:60px">
                            <button type="button" class="layui-btn" style="vertical-align:bottom" id="imagebtn2">图2</button>
                            <img class="layui-upload-img" id="image3" src="" style="width:60px;height:60px">
                            <button type="button" class="layui-btn" style="vertical-align:bottom" id="imagebtn3">图3</button>
                            <img class="layui-upload-img" id="image4" src="" style="width:60px;height:60px">
                            <button type="button" class="layui-btn" style="vertical-align:bottom" id="imagebtn4">图4</button>
                            <img class="layui-upload-img" id="image5" src="" style="width:60px;height:60px">
                            <button type="button" class="layui-btn" style="vertical-align:bottom" id="imagebtn5">图5</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-form-item">
                    <label class="layui-form-label">正文文字</label>

                    <div class="layui-input-block">
                        <textarea name="data_text" placeholder="请输入备注信息" class="layui-textarea" style="height:180px">#(notice.data_text)</textarea>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="submit" class="layui-btn" lay-submit="" lay-filter="Submit1">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
<script src="../../static/plugins/layui/layui.js"></script>

<SCRIPT LANGUAGE="JavaScript">
    <!--
    layui.config({
        base: '../../static/plugins/layuiadmin/' //静态资源所在路径
    }).use('index');

    layui.use('laydate', function () {
        layui.laydate.render({
            elem: '#not_time', type: 'datetime', format: 'yyyy-MM-dd HH:mm'
        });
    });

    //上传
    layui.use('upload', function () {
        layui.upload.render({
            elem: '#imagebtn1', url: 'UploadImages', size: 300, accept: 'image', exts: 'jpg|gif|png'
            , done: function (res) {
                if (res.code == 0) {
                    $('#image1').attr('src', res.object.view_path);
                    $('#data_img1').val(res.object.save_path);
                    return layer.msg('上传成功');
                } else {
                    return layer.msg('上传失败');
                }
            }
        });
        layui.upload.render({
            elem: '#imagebtn3', url: 'UploadImages', size: 300, accept: 'image', exts: 'jpg|gif|png'
            , done: function (res) {
                if (res.code == 0) {
                    $('#image3').attr('src', res.object.view_path);
                    $('#data_img3').val(res.object.save_path);
                    return layer.msg('上传成功');
                } else {
                    return layer.msg('上传失败');
                }
            }
        });
        layui.upload.render({
            elem: '#imagebtn2', url: 'UploadImages', size: 300, accept: 'image', exts: 'jpg|gif|png'
            , done: function (res) {
                if (res.code == 0) {
                    $('#image2').attr('src', res.object.view_path);
                    $('#data_img2').val(res.object.save_path);
                    return layer.msg('上传成功');
                } else {
                    return layer.msg('上传失败');
                }
            }
        });
        layui.upload.render({
            elem: '#imagebtn4', url: 'UploadImages', size: 300, accept: 'image', exts: 'jpg|gif|png'
            , done: function (res) {
                if (res.code == 0) {
                    $('#image4').attr('src', res.object.view_path);
                    $('#data_img4').val(res.object.save_path);
                    return layer.msg('上传成功');
                } else {
                    return layer.msg('上传失败');
                }
            }
        });
        layui.upload.render({
            elem: '#imagebtn5', url: 'UploadImages', size: 300, accept: 'image', exts: 'jpg|gif|png'
            , done: function (res) {
                if (res.code == 0) {
                    $('#image5').attr('src', res.object.view_path);
                    $('#data_img5').val(res.object.save_path);
                    return layer.msg('上传成功');
                } else {
                    return layer.msg('上传失败');
                }
            }
        });
    });

    layui.use('form', function () {
        var form = layui.form;
        form.on('submit(Submit1)', function (data) {
            layui_ext.AjaxJson($, layer, "ModifySysNoticeApi", {postdata: JSON.stringify(data.field)}, function () {
                parent.layer.close(parent.index);
            }, data.field.actions == 'EDIT' ? '修改' : '添加');
            return false;
        });
    });
    //-->
</SCRIPT>
</body>
</html>